from superdice.libs.diceConfigs import configFile
from superdice.superdice import registerRoll, unregisterRoll

def es_map_start(ev):
    cfgData.execute()

def unload():
    unregisterRoll(diceRoll)

def diceRoll(userid, player, eplayer):
    health = player.health - int(healthlose)
    if health <= 0:
        eplayer.damagePlayer(player.health)

    else:
        player.health = health

cfgData = configFile('dice_healthlose')
healthlose = cfgData.cvar('superdice_cfg_healthlose_health', 50, 'How much health does the player lose?')
cfgData.write()
cfgData.execute()

registerRoll(diceRoll, 'healthlose')
